import request from '@/utils/request'

/**
 * 学生作业减免权益API
 */
const studentBenefitApi = {
  // 获取可兑换权益列表
  getBenefitList: () => request({
    url: '/system/studentBenefit/list',
    method: 'get'
  }),
  
  // 兑换权益（修复参数传递：path参数+请求体）
  exchangeBenefit: (benefitId, needDowngrade) => request({
    url: `/system/studentBenefit/exchange/${benefitId}`, // benefitId作为路径参数
    method: 'post',
    data: { needDowngrade } // needDowngrade作为请求体参数
  }),
  
  // 获取兑换历史
  getExchangeHistory: () => request({
    url: '/system/studentBenefit/exchange/history',
    method: 'get'
  }),
  
  // 获取当前经验值
  getCurrentExp: () => request({
    url: '/system/studentBenefit/currentExp',
    method: 'get'
  })
}

export default studentBenefitApi